// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取优惠码 GET /api/promotion */
export async function getPromotionCode(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getPromotionCodeParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseListPromotionVo>('/api/promotion', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 校验优惠码 GET /api/promotion/check */
export async function checkPromotionCode(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.checkPromotionCodeParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePromotionVo>('/api/promotion/check', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 生成优惠码 POST /api/promotion/gen */
export async function createPromotionCode(options?: { [key: string]: any }) {
  return request<API.BaseResponse>('/api/promotion/gen', {
    method: 'POST',
    ...(options || {}),
  });
}

/** 使用优惠码 POST /api/promotion/use */
export async function usePromotionCode(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.usePromotionCodeParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean>('/api/promotion/use', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
